package com.dsg.controller.account;


import com.dsg.common.constants.MessageConstants;
import com.dsg.common.dto.AjaxResult;
import com.dsg.controller.base.BaseController;
import com.dsg.entity.account.DsgAccountCard;
import com.dsg.service.account.IDsgAccountCardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 油咭總帳 前端控制器
 * </p>
 *
 * @author system
 * @since 2020-07-12
 */
@RestController
@RequestMapping("/account/dsgAccountCard")
@Api(description = "油咭總帳")
public class DsgAccountCardController extends BaseController {

    @Autowired
    private IDsgAccountCardService service;

    /**
     * 查詢用戶賬戶情況
     *
     * @param cusNo
     * @return
     */
    @GetMapping(value = "/listUserAccount")
    @ApiOperation("查詢用戶賬戶情況")
    public AjaxResult listUserAccount(@ApiParam(value = "客户编号", name = "cusNo", required = true) @RequestParam String cusNo) {
        List<DsgAccountCard> dsgAccountCardList = service.selectUserAccountList(cusNo);
        return json(MessageConstants.SSO_STATUS_SUCCESS, dsgAccountCardList);
    }

    /**
     * 查詢油咭狀態列表
     * @param cusNo
     * @return
     */
    @GetMapping(value = "/listUserCardAccount")
    @ApiOperation("查詢油咭狀態列表")
    public AjaxResult listUserCardAccount(@ApiParam(value = "客户编号", name = "cusNo", required = true) @RequestParam String cusNo) {
        List<DsgAccountCard> dsgAccountCardList = service.selectUserCardAccountList(cusNo);
        return json(MessageConstants.SSO_STATUS_SUCCESS, dsgAccountCardList);
    }
}
